﻿package mortal.game.net.command.worldBoss
{
    import Framework.MQ.*;
    import Message.Client.*;
    import Message.Command.*;
    import Message.Game.*;
    import Message.Public.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.mvc.core.*;

    public class WorldBossCommand extends BroadCastCall
    {

        public function WorldBossCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_3:IMessageBase = null;
            var _loc_4:SEntityId = null;
            var _loc_5:SWorldBossHurtList = null;
            var _loc_6:SFieldBossHurtList = null;
            var _loc_7:SGuildItemBetUpdateInfo = null;
            var _loc_8:SGuildItemDiceUpdateInfo = null;
            super.call(param1);
            var _loc_2:* = param1.messageHead.command;
            _loc_3 = param1.messageBase;
            switch(_loc_2)
            {
                case EPublicCommand._ECmdPublicWorldBossBelong:
                {
                    _loc_4 = _loc_3 as SEntityId;
                    NetDispatcher.dispatchCmd(ServerCommand.WorldBossBelong, _loc_4);
                    break;
                }
                case EPublicCommand._ECmdPublicWorldBossHurtList:
                {
                    _loc_5 = _loc_3 as SWorldBossHurtList;
                    NetDispatcher.dispatchCmd(ServerCommand.WorldBossHurtList, _loc_5);
                    break;
                }
                case EPublicCommand._ECmdPublicFieldBossHurtList:
                {
                    _loc_6 = _loc_3 as SFieldBossHurtList;
                    NetDispatcher.dispatchCmd(ServerCommand.SmallBossHurtList, _loc_6);
                    break;
                }
                case EPublicCommand._ECmdPublicGuildItemBetUpdate:
                {
                    _loc_7 = _loc_3 as SGuildItemBetUpdateInfo;
                    this.updateWorldBossGuildItem(_loc_7);
                    break;
                }
                case EPublicCommand._ECmdPublicGuildItemDiceUpdate:
                {
                    _loc_8 = _loc_3 as SGuildItemDiceUpdateInfo;
                    this.updateGuildItemDice(_loc_8);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        protected function updateWorldBossGuildItem(param1:SGuildItemBetUpdateInfo) : void
        {
            var _loc_2:* = Cache.instance.copy.worldBoss.getBetInfo(param1.bossCode);
            if (!_loc_2 || param1.status == EWorldBossAllotStatus._ESignUp && _loc_2.status != EWorldBossAllotStatus._ESignUp)
            {
                NetDispatcher.dispatchCmd(ServerCommand.WorldBossBetStart, param1);
            }
            Cache.instance.copy.worldBoss.updateBetInfo(param1);
            NetDispatcher.dispatchCmd(ServerCommand.WorldBossBetUpdateInfo, param1);
            return;
        }// end function

        protected function updateGuildItemDice(param1:SGuildItemDiceUpdateInfo) : void
        {
            Cache.instance.copy.worldBoss.updateDiceInfo(param1);
            NetDispatcher.dispatchCmd(ServerCommand.WorldBossDiceUpdate, param1);
            return;
        }// end function

    }
}
